package com.myd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.myd.dao.ExtremeDataDao;
import com.myd.model.ExtremeData;
import com.myd.service.ExtremeDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExtremeDataServiceImpl implements ExtremeDataService {
    @Autowired
    private ExtremeDataDao extremeDataDao;

    @Override
    public boolean insertData(ExtremeData e) {
        int res = extremeDataDao.insert(e);
        return res > 0;
    }

    @Override
    public boolean insertExcelData(List<ExtremeData> list) {
        int cnt = 0;
        for (ExtremeData extremeData : list) {
            cnt += extremeDataDao.insert(extremeData);
        }
        return cnt>0;
    }

    @Override
    public List<ExtremeData> selectListByStation_no(int station_no) {
        List<ExtremeData> list = extremeDataDao.selectList(new QueryWrapper<ExtremeData>().eq("station_no", station_no));
        return list;
    }
}
